home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / sndhrdw / depthch.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  1KB  |  80 lines

  1. /*
  2.  *    Depth Charge sound routines
  3.  */
  4.  
  5. #include "driver.h"
  6.  
  7.  
  8. /* output port 0x01 definitions - sound effect drive outputs */
  9. #define OUT_PORT_1_LONGEXPL     0x01
  10. #define OUT_PORT_1_SHRTEXPL     0x02
  11. #define OUT_PORT_1_SPRAY        0x04
  12. #define OUT_PORT_1_SONAR        0x08
  13.  
  14.  
  15. #define PLAY(id,loop)           sample_start( id, id, loop )
  16. #define STOP(id)                sample_stop( id )
  17.  
  18.  
  19. /* sample file names */
  20. const char *depthch_sample_names[] =
  21. {
  22.     "*depthch",
  23.     "longex.wav",
  24.     "shortex.wav",
  25.     "spray.wav",
  26.     "sonar.wav",
  27.     "sonarena.wav",    /* currently not used */
  28.     0
  29. };
  30.  
  31. /* sample sound IDs - must match sample file name table above */
  32. enum
  33. {
  34.     SND_LONGEXPL = 0,
  35.     SND_SHRTEXPL,
  36.     SND_SPRAY,
  37.     SND_SONAR,
  38.     SND_SONARENA
  39. };
  40.  
  41.  
  42. WRITE_HANDLER( depthch_sh_port1_w )
  43. {
  44.     static int port1State = 0;
  45.     int bitsChanged;
  46.     int bitsGoneHigh;
  47.     int bitsGoneLow;
  48.  
  49.  
  50.     bitsChanged  = port1State ^ data;
  51.     bitsGoneHigh = bitsChanged & data;
  52.     bitsGoneLow  = bitsChanged & ~data;
  53.  
  54.     port1State = data;
  55.  
  56.     if ( bitsGoneHigh & OUT_PORT_1_LONGEXPL )
  57.     {
  58.         PLAY( SND_LONGEXPL, 0 );
  59.     }
  60.  
  61.     if ( bitsGoneHigh & OUT_PORT_1_SHRTEXPL )
  62.     {
  63.         PLAY( SND_SHRTEXPL, 0 );
  64.     }
  65.  
  66.     if ( bitsGoneHigh & OUT_PORT_1_SPRAY )
  67.     {
  68.         PLAY( SND_SPRAY, 0 );
  69.     }
  70.  
  71.     if ( bitsGoneHigh & OUT_PORT_1_SONAR )
  72.     {
  73.         PLAY( SND_SONAR, 1 );
  74.     }
  75.     if ( bitsGoneLow & OUT_PORT_1_SONAR )
  76.     {
  77.         STOP( SND_SONAR );
  78.     }
  79. }
  80.